<?php (!defined('IN_SYSTEM') || !defined('ADMIN_PRE')) && exit('Access Denied!');?>
{admintemplate header}
<div class="box">
 	<div class="heading">
		<h1>标签管理</h1>
	<div class="buttons">
	<a href="<?php echo url('admin.php?m=tag&f=add')?>">添加标签</a>
	<a href="<?php echo url('admin.php?m=tag')?>">所有标签</a>
	</div>	
	</div>
	<div class="main">

	<?php if ($f == 'index') {?>
		<div class="search">
			<form name="search" method="get" action="admin.php">
			<input type="hidden" name="m" value="tag" />
			<input type="hidden" name="f" value="index" />
				<fieldset>
					<legend>标签查找</legend>
						文章数：
						<input type="text" name="min" size="6" value="<?php echo $min?>" /> -  
						<input type="text" name="max" size="6" value="<?php echo $max?>" />
						关键字：
						<input type="text" name="keyword" size="15" value="<?php echo $keyword?>" />
						<input type="submit" name="s" class="button" value="开始查找" />
						<input type="button" class="button" value="所有标签" onclick="window.location.href='admin.php?m=tag&f=index'" />
				</fieldset>
			</form>
		</div>
		
		<form name="op" method="post" action="?m=tag">
		<input type="hidden" name="dosubmit" value="1" />
			<table class="list" cellspacing="0" id="list">
				<thead>
				<tr>
					<td width="1"><input type="checkbox" class="checkbox" value="1" name="chkall" onclick="check_all(this)" /></td>
					<td class="left">名称</td>
					<td width="100" class="center">文章数</td>
				</tr>
				</thead>
				<?php foreach ($result as $row) { ?>
				<tr id="row_<?php echo $row['tagid']?>">
					<td class="center"><input type="checkbox" name="id[]" value="<?php echo $row['tagid']?>" class="checkbox" /></td>
					<td class="left"><a href="?m=tag&f=edit&id=<?php echo $row['tagid']?>"><?php echo $row['tagname']?></a></td>
					<td class="center"><b style="color:red"><?php echo $row['total']?></b></td>
				</tr>
				<?php } ?>
				<tr>
					<td class="center">
					<input type="checkbox" class="checkbox" value="1" name="chkall" onclick="check_all(this)" /></td>
					<td colspan="2"><?php echo pager($num,$pagesize,$page,$url); ?>
					全选 
					<input type="radio" name="f" value="update" id="update" checked="checked" class="checkbox" /><label for="update">更新统计</label> 
					<input type="radio" name="f" value="delete" id="delete" class="checkbox" /><label for="delete">删除</label> 
					<input type="radio" name="f" value="merge" id="merge" class="checkbox" /><label for="merge">合并到：</label>
					<input type="text" name="newtag" size="8" style="display:inline" /> 
					<input type="submit" name="submit" value="执行操作" class="button" />
					</td>
				</tr>
			</table>
		</form>
	
	<?php } elseif ( $f == 'add' || $f == 'edit' ) { ?>
	<table cellspacing="5">
		<tr>
			<td>
			<form name="edit" method="post" action="?m=tag&f=<?php echo $f?>" onsubmit="return check_tag_add()">
			<input type="hidden" name="dosubmit" value="1" />
			<input type="hidden" name="savetype" value="<?php echo $f?>" />
			<input type="hidden" name="id" value="<?php echo $result['tagid']?>" />
				标签名称：<input type="text" name="tagname" size="20" class="input" value="<?php echo $result['tagname']?>" /> <input type="submit" class="button" name="submit" value=" 保 存 " />
			</form>
			</td>
		</tr>
	</table>
	<?php }?>
	</div>
</div>
{admintemplate footer}